package com.ruoyi.web.controller.app.controller;

import com.ruoyi.framework.web.exception.base.XResult;
import com.ruoyi.web.controller.app.request.RequestRechargeEntity;
import com.ruoyi.web.controller.app.service.AppQianYiFuService;
import com.ruoyi.web.controller.pay.PayResponseBody;
import com.ruoyi.web.controller.pay.ToPayEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName AppQianYiFuController
 * @Description TODO
 * @Author tyc@yanyu
 * @Date 2018/12/24 0024 11:17
 **/
@RequestMapping("/app/qianyifu")
@RestController
@Api(tags = "乾易付支付接口")
public class AppQianYiFuController {

    @Autowired
    private AppQianYiFuService appQianYiFuService;

    // @FilterAnnotation(validator = true)
    @RequestMapping(value = "createOrder", method = RequestMethod.POST)
    @ApiOperation(value = "乾易付下单")
    public Object createOrder(ToPayEntity entity) {
        return appQianYiFuService.createOrder(entity);
    }

    @RequestMapping(value = "getBack", method = RequestMethod.POST)
    @ApiOperation(value = "支付回调")
    public Object getBack(PayResponseBody entity) {
        return appQianYiFuService.getPayBack(entity);
    }

    @PostMapping(value = "recharge")
    @ApiOperation(value = "平台充值")
    public Object recharge(RequestRechargeEntity entity) {
        return new XResult("充值成功", appQianYiFuService.recharge(entity));
    }
}
